package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	file, _ := os.OpenFile("/Users/dean/GoWorks/src/gomod/exercise/a.txt", os.O_RDWR, os.ModePerm)
	defer file.Close()

	reader := bufio.NewReader(file)
	buf := make([]byte, 1024)
	n, _ := reader.Read(buf)
	fmt.Println(n)
	fmt.Println(string(buf[:n]))

	inputReader := bufio.NewReader(os.Stdin)
	writeNum, _ := inputReader.ReadString('\n')
	fmt.Println("writenud:", writeNum)

	writer := bufio.NewWriter(file)
	n3, _ := writer.WriteString("hello")
	fmt.Println(n3)
	writer.Flush()

}
